<?php 
// 获取用户同意,检测环境

$agree = $_GET['agree'];
if ($agree != 1){
    echo '不同意不安装';
    exit();
}


?>

<!DOCTYPE html>
<html>
    <head>
        <title>检测环境结果</title>
        <meta chatset="utf-8">
    </head>
    <style type="text/css">
    .main-div{
        width:960px;
        padding:15px;
        margin:25px auto;
        border:1px solid rgb(240,240,240);
    }
    body {
        background-color:#F8F8F8;   
    }
    </style>
    <body>
        <div class="main-div">
            <!-- 输入配置信息 -->
            <center>
            <h1>检测环境结果</h1>
            <form action="input_config.php">
                <table border="1" cellspacing="1" style="width:80%;height:350px;">
                    <tr>
                        <td>检测项目</td>
                        <td>检测结果</td>
                        <td>是否通过</td>
                    </tr>
                    <tr>
                        <td>操作系统:</td>
                        <td><?php echo PHP_OS;?></td>
                        <td><span style="color:green">通过</span></td>
                    </tr>
                    <tr>
                        <td>PHP版本</td>
                        <td><?php echo PHP_VERSION;?></td>
                        <td>
                            <?php 
                            $error = 0;
                            if (version_compare(PHP_VERSION, '5.6', '>')){
                                echo '<span style="color:green">通过</span>';
                            } else {
                                echo '<span style="color:red">最低版本5.6</span>';
                                $error = 1;
                            }
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td>mysql模块是否开启</td>
                        <td>
                        <?php
                        $error1 = 0;
                        if (function_exists('mysqli_close')) {
                            echo '开启';
                        } else {
                            echo '未开启';
                            $error1 = 1;
                        }
                        ?>
                            
                        </td>
                        <td>
                            <?php
                            if ($error1){
                                echo '<span style="color:red">需要开启mysql的扩展</span>';
                            } else {
                                echo '<span style="color:green">通过</span>';
                            }
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td>是否可读写:</td>
                        <td>
                        <?php
                            $error2 = 0;
                            if (is_writable('..') && is_readable('..')){
                                echo '<span style="color:green">可读可写</span>';
                            } else {
                                $error2 = 1;
                                echo '<span style="color:red">不可读写</span>';
                            }
                        ?>
                        </td>
                        <td>
                        <span style="color:green">
                            <?php
                                if ($error2){
                                    echo '<span style="color:red">不通过</span>';
                                } else {
                                    echo '<span style="color:green">通过</span>';
                                }
                            ?>
                        </span>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">
                        <?php
                        if ($error || $error1 || $error2){
                            echo '<span style="color:red">不能继续了</span>';
                        } else {
                            echo '<button type="submit">下一步</button>';
                        }
                        ?>
                        </td>
                    </tr>
                </table>
            </form>

            </center>
        </div>
    </body>
</html>